class Siteadmin::ProfilesController < ApplicationController
	before_filter :require_admin
	load_and_authorize_resource

	layout 'admin'
	active_scaffold :profiles do |config|
		config.nested.add_link("Educations", [:educations])
    config.nested.add_link("JSTP Act.", [:activities])		
    config.nested.add_link("Researches", [:researches])
		config.nested.add_link("Awards", [:awards])
		config.nested.add_link("Works", [:workplaces])
		config.nested.add_link("Families", [:families])
    
		config.columns[:nameth].label = 'ชื่อ'
		config.columns[:lastnameth].label = 'นามสกุล'
		config.columns[:nameeng].label = 'ชื่อ(อังกฤษ)'
		config.columns[:lastnameeng].label = 'นามสกุล(อังกฤษ)'
		config.columns[:title].label = 'คำนำหน้า'
		config.columns[:position].label = 'ตำแหน่งวิชาการ'

		config.list.columns = [
			:name,
			:nickname,
			:user,
			:email,
			:celphone,
			:generation]

		config.create.columns = [
			:title,
			:position,
			:nameth,
			:lastnameth,
			:nameeng,
			:lastnameeng,
			:generation,
			:nickname,
			:birthday,
			:nationality,
			:religious,
			:studystatus,
			:socialstatus,
			:address,
			:telphone,
			:celphone,
			:email,
			:blogaddress
		]

		config.update.columns = [
			:title,
			:position,
			:nameth,
			:lastnameth,
			:nameeng,
			:lastnameeng,
			:generation,
			:nickname,
			:birthday,
			:nationality,
			:religious,
			:studystatus,
			:socialstatus,
			:address,
			:telphone,
			:celphone,
			:email,
			:blogaddress
		]
		config.show.columns = [
			:title,
			:position,
			:nameth,
			:lastnameth,
			:nameeng,
			:lastnameeng,
			:generation,
			:nickname,
			:birthday,
			:nationality,
			:religious,
			:studystatus,
			:socialstatus,
			:address,
			:telphone,
			:celphone,
			:email,
			:blogaddress
		]
		#config.create.columns.exclude [
		#	:user,
		#	:comments,
		#	:awards,
		#	:has_image_file,
		#	:educations,
		#	:researches,
		#	:workplaces,
		#	:created_at,
		#	:updated_at]

		#config.update.columns.exclude [:blogaddress,
		#	:address,
		#	:nationality,
		#	:religious,
		#	:socialstatus,
		#	:awards,
		#	:has_image_file,
		#	:educations,
		#	:researches,
		#	:workplaces,
		#	:comments,
		#	:created_at,
		#	:updated_at]
	end

end
